//客户管理
import request from "@/utils/request";

//批量绑定客户经理
export function updateCutomerManager(data) {
  return request({
    url: `/cmsMatch/bindManager`,
    method: "post",
    data: data,
  });
}
//绑定所有客户经理
export function updateAllCutomerManager(data) {
  return request({
    url: `/cmsMatch/bindManager`,
    method: "post",
    data: data,
  });
}
//获取企业报告基本信息详情
export function getEnterpriseReport(data) {
  return request({
    url: `/tax/share/getEnterpriseReport`,
    method: "get",
    params: data,
  });
}
// 根据会员ID获取税务查询记录
export function getMemberEnterprise(data) {
  return request({
    url: "/enterprise/member",
    method: "get",
    params: data,
  });
}

// 会员数据列表
export function getMemberList(data) {
  return request({
    url: "/statistics/member/list",
    method: "get",
    params: data,
  });
}

// 会员曲线图
export function getMemberLineCharts(data) {
  return request({
    url: "/statistics/member/chart",
    method: "get",
    params: data,
  });
}

// 会员概览数据
export function getMemberOverview(data) {
  return request({
    url: "/statistics/member/overview",
    method: "get",
  });
}

// 会员渠道图
export function getMemberPieCharts(data) {
  return request({
    url: "/statistics/member/channel",
    method: "get",
    params: data,
  });
}

//会员注册图
export function getMemberRegister(data) {
  return request({
    url: "/statistics/member/register/chart",
    method: "get",
    params: data,
  });
}

//会员访问图
export function getMemberVisit(data) {
  return request({
    url: "/statistics/member/visit/chart",
    method: "get",
    params: data,
  });
}

//平台占比图

export function getMemberProportion(data) {
  return request({
    url: "/statistics/member/platform",
    method: "get",
    params: data,
  });
}

// 获取某个答卷详情
export function getAnswerSheetDetail(data) {
  return request({
    url: "/question/getAnswerSheetDetail",
    method: "get",
    params: data,
  });
}
/**
 * 向公司添加客户信息
 * @param {Object} data 客户信息数据对象，包含客户的各种信息字段
 *
 */
export function addCompanyCustomer(data) {
  return request({
    url: "/company",
    method: "post",
    data: data,
  });
}

/**
 * 删除指定公司的客户
 * @param {number} id - 公司的唯一标识符
 *
 */
export function deleteCompanyCustomer(id) {
  // 发送删除请求到服务器
  return request({
    url: `/company/${id}`,
    method: "delete",
  });
}

/**
 * 编辑公司客户信息
 * @param {Object} data - 要编辑的客户信息数据对象
 *
 */
export function editCompanyCustomer(data) {
  return request({
    url: "/company",
    method: "put",
    data: data,
  });
}

/**
 * 获取公司客户列表
 * @param {Object} data - 请求参数对象
 *
 */
export function getCompanyCustomerList(data) {
  return request({
    url: "/company",
    method: "get",
    params: data,
  });
}

/**
 * 获取指定公司的客户详情
 * @param {string} id - 公司的唯一标识符
 */
export function getCompanyCustomerDetail(id) {
  return request({
    url: `/company/${id}`,
    method: "get",
  });
}

/**
 * 导出一个用于添加客户人员的函数
 *
 * @returns {Promise} 返回一个Promise对象，成功时携带添加的客户信息，失败时携带错误信息
 */
export function addCustomerPerson(data) {
  // 向服务器发送POST请求，添加一个新的客户人员
  return request({
    url: "/customer",
    method: "post",
    data,
  });
}

/**
 * 删除指定客户的客户人员
 * @param {number} id - 客户人员的唯一标识符
 *
 */
export function deleteCustomerPerson(id) {
  // 发送删除请求到服务器
  return request({
    url: `/customer/${id}`,
    method: "delete",
  });
}

/**
 * 编辑客户人员信息
 * @param {Object} data - 要编辑的客户人员信息数据对象
 *
 */

export function editCustomerPerson(data) {
  return request({
    url: "/customer",
    method: "put",
    data: data,
  });
}

/**
 * 获取客户人员列表
 * @param {Object} data - 请求参数对象
 *
 */

export function getCustomerPersonList(data) {
  return request({
    url: "/customer",
    method: "get",
    params: data,
  });
}

/**
 * 获取指定客户的客户人员详情
 * @param {string} id - 客户人员的唯一标识符
 */

export function getCustomerPersonDetail(id) {
  return request({
    url: `/customer/${id}`,
    method: "get",
  });
}

/**
 * 获取匹配列表
 * @param {Object} data - 请求参数对象
 * @returns {Promise} 返回一个Promise对象，包含服务器响应的结果
 */
export function getCmsMatchList(data) {
  // 发起GET请求获取CMS匹配列表
  return request({
    url: "/cmsMatch/getLastMatchList",
    method: "get",
    params: data,
  });
}

/**
 * 获取匹配详情
 *
 * @returns {Promise} 返回一个Promise对象，包含服务器响应的结果
 */
export function getCmsMatchDetail(data) {
  // 使用提供的id，发起GET请求以获取特定CMS匹配项的详细信息
  return request({
    url: `/cmsMatch/detail`,
    method: "get",
    params: data,
  });
}

/**
 *  获取基本信息详情接口--- 企业报告详情
 * @param {Object} data - 请求参数对象
 */

export function getCmsMatchDetailInfo(data) {
  return request({
    url: `/cmsMatch/getEnterpriseReport`,
    method: "get",
    params: data,
  });
}

/**
 * 查询企业近三年纳税信息
 * @param id
 */

export function getEnterprisePaidTaxesAmountInfo(id) {
  return request({
    url: `/cmsMatch/getEnterprisePaidTaxesAmount/${id}`,
    method: "get",
  });
}

/**
 * 查询企业近三年 开票金额
 * @param id
 */

export function getEnterpriseApplyAmountInfo(id) {
  return request({
    url: `/cmsMatch/getEnterpriseApplyAmount/${id}`,
    method: "get",
  });
}

/**
 * 查询企业工商司法信息
 * @param id
 */

export function getEnterpriseCasesInfo(id) {
  return request({
    url: `cmsMatch/getEnterpriseCases/${id}`,
    method: "get",
  });
}

/**
 *  录入征信
 */

export function addCreditInfo(data) {
  return request({
    url: `/credit/updateCreditInfo`,
    method: "post",
    data: data,
  });
}

/**
 * 获取征信详情
 */

export function getCreditInfo(params) {
  return request({
    url: `/credit/getCreditInfo`,
    method: "get",
    params,
  });
}
//创建征信任务
export function getCreditInfoTask(data) {
  return request({
    url: `/credit/ocr/task`,
    method: "post",
    data,
  });
}

//获取征信报告任务状态
export function getCreditInfoTaskStatus(id) {
  return request({
    url: `/credit/ocr/task/status/${id}`,
    method: "get",
  });
}

//获取征信报告详情
export function getCreditInfoTaskResult(params) {
  return request({
    url: `/credit/ocr/task/detail`,
    method: "get",
    params,
  });
}

//精准匹配入口
export function matchingProductPrecision(params) {
  return request({
    url: `/match/matchingProductPrecision`,
    method: "get",
    params,
  });
}

//保存可贷额度
export function saveQuota(data) {
  return request({
    url: `/match/saveQuota`,
    method: "post",
    data,
  });
}

//获取企业前十供应商信息
export function getgetEnterpriseInvoiceTopTen(id) {
  return request({
    url: `/cmsMatch/getEnterpriseInvoiceTopTen/${id}`,
    method: "get",
  });
}

//分配客户经理
export function assignCustomerManager(data) {
  return request({
    url: `/company/batch/bind/manager`,
    method: "post",
    data,
  });
}
//校验是否分配客户经理
export function checkCustomerManager(data) {
  return request({
    url: `/company/batch/check/manager`,
    method: "post",
    data,
  });
}
// 删除匹配
export function deleteMatch(id) {
  return request({
    url: `/company/${id}`,
    method: "delete",
  });
}
//获取企业详情-沟通

export function companyRrecord(id) {
  return request({
    url: `/company/record/last/${id}`,
    method: "get",
  });
}
//添加企业客服沟通
export function companyRecordCreate(data) {
  return request({
    url: `/company/record/create`,
    method: "post",
    data,
  });
}
//获取企业客户沟通记录
export function companyRecordList(data) {
  return request({
    url: `/company/record/page`,
    method: "get",
    params: data,
  });
}

//获取记录详情
export function getCompanyRecordDetail(id) {
  return request({
    url: `/company/record/${id}`,
    method: "get",
  });
}
//保存可贷额度
export function saveAloneQuota(data) {
  return request({
    url: `/match/saveAloneQuota`,
    method: "post",
    data,
  });
}

//获取客户经理列表
export function getCustomerManagerList() {
  return request({
    url: `/admin/managerListAll`,
    method: "get",
  });
}

//获取办理业务员 接口
export function getsalesmanList() {
  return request({
    url: `/admin/salesmanListAll`,
  });
}
// 获取海报素材列表
export function getPlacardPage(data) {
  return request({
    url: `/material/page`,
    method: "get",
    params: data,
  });
}

export function downloadCode(id) {
  return request({
    url: `/material/download/${id}`,
    method: "get",
  });
}
//获取纳税类型
export function getTaxTypeList(params) {
  return request({
    url: `/cmsMatch/getEnterprisePaidTaxesDataList`,
    method: "get",
    params,
  });
}

//获取纳税信息- 开票
export function getEnterpriseApplyAmount(params) {
  return request({
    url: `/cmsMatch/getEnterpriseApplyAmount`,
    method: "get",
    params,
  });
}
//获取匹配结果列表
export function getMatchResultList(params) {
  return request({
    url: `/match/listProduct`,
    method: "get",
    params,
  });
}

//获取指定企业的匹配记录

export function getMatchRecordList(params) {
  return request({
    url: `/cmsMatch/getCmsMatchListByCreditCode`,
    method: "get",
    params,
  });
}

//录入征信报告

export function addV2CreditInfo(data) {
  return request({
    url: `/credit/v2/saveOrUpdateCreditInfo`,
    method: "post",
    data,
  });
}

//查询征信报告

export function getV2CreditInfo(creditId) {
  return request({
    url: `/credit/v2/getCreditInfo/${creditId}`,
    method: "get",
  });
}

// 保存客户沟通记录

export function saveCreditCustomerRecord(data) {
  return request({
    url: `/contact/v2/saveOrUpdateContactInfo`,
    method: "post",
    data,
  });
}

// 查询客户沟通记录
export function getCreditCustomerRecord(data) {
  return request({
    url: `/contact/v2/getContactInfo/${data}`,
    method: "get",
  });
}

//新增客户资料
export function addCreditCustomer(data) {
  return request({
    url: `/cmsClient`,
    method: "post",
    data,
  });
}

// 修改客户资料
export function getCreditCustomerList(data) {
  return request({
    url: `/cmsClient`,
    method: "put",
    data,
  });
}


//获取客户资料列表
export function getCreditCustomer(data) {
  return request({
    url: `/cmsClient/page`,
    method: "get",
    params: data,
  });
}
//获取客户资料详情
export function getCreditCustomerDetail(data) {
  return request({
    url: `/cmsClient/${data}`,
    method: "get",
  });
}
//删除客户资料
export function deleteCreditCustomerPerson(data) {
  return request({
    url: `/cmsClient/${data}`,
    method: "delete",
  });
}
